//
//  BCLanguageSettingCell.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/12/29.
//  Copyright © 2018 guoshikeji. All rights reserved.
//

#import "BCLanguageSettingCell.h"

@interface BCLanguageSettingCell ()

@property (nonatomic, strong) QMUILabel *originalLabel;

/**
 *localLabel
 */
@property (nonatomic, strong) QMUILabel *localLabel;


@end

@implementation BCLanguageSettingCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubviews];
    }
    return self;
}
- (void)setupSubviews {
    self.originalLabel = [QMUILabel new];
    self.originalLabel.textColor = [UIColor qmui_colorWithHexString:@"#000000"];
    self.originalLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
    [self.contentView addSubview:self.originalLabel];
    [self.originalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).offset(15.0);
        make.bottom.mas_equalTo(self.mas_centerY);
        make.right.mas_equalTo(self.contentView);
    }];
    //
    self.localLabel = [QMUILabel new];
    self.localLabel.textColor = [UIColor qmui_colorWithHexString:@"#333333"];
    self.localLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
    [self.contentView addSubview:self.localLabel];
    [self.localLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.originalLabel);
        make.top.mas_equalTo(self.originalLabel.mas_bottom).offset(3.0);
        make.right.mas_equalTo(self.contentView);
    }];
    //
    [self addSubview:self.separatorLine];
    [self.separatorLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.originalLabel);
        make.bottom.right.mas_equalTo(self);
        make.height.mas_equalTo(1.0);
    }];
}

- (void)setCellModel:(LanguageSettingCellModel *)cellModel {
    _cellModel = cellModel;
    //
    self.originalLabel.text = cellModel.originalLanguageString;
    self.localLabel.text = cellModel.localLanguageString;
    //
    self.accessoryType = cellModel.isCurrent?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
}


+ (CGFloat)defaultHeight {
    return 56.0;
}

@end
